.class Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;
.super Ljava/lang/Object;
.source "RequestLinkAccountRunnable.java"

# interfaces
.implements Ljava/lang/Runnable;


# static fields
.field static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field static final MS_IN_SEC:I = 0x3e8

.field static final OK_SERVER_CODE:Ljava/lang/String; = "0"

.field static final TAG:Ljava/lang/String; = null

.field static final USER_NOT_FOUND_CODE:Ljava/lang/String; = "2"


# instance fields
.field final mAccount:Lcom/burstly/lib/currency/UserAccount;

.field final mDelayTime:Ljava/util/concurrent/atomic/AtomicInteger;

.field final mNewAccount:Lcom/burstly/lib/currency/AccountInfo;

.field mTryInactiveAccounts:Z

.field final mUIHandler:Landroid/os/Handler;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 54
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 59
    const-class v0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->TAG:Ljava/lang/String;

    return-void
.end method

.method constructor <init>(Lcom/burstly/lib/currency/UserAccount;Lcom/burstly/lib/currency/AccountInfo;)V
    .locals 2
    .parameter "account"
    .parameter "newAccount"

    .prologue
    .line 92
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 74
    new-instance v0, Ljava/util/concurrent/atomic/AtomicInteger;

    const/16 v1, 0xa

    invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>(I)V

    iput-object v0, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mDelayTime:Ljava/util/concurrent/atomic/AtomicInteger;

    .line 79
    new-instance v0, Landroid/os/Handler;

    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    iput-object v0, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mUIHandler:Landroid/os/Handler;

    .line 93
    iput-object p1, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mAccount:Lcom/burstly/lib/currency/UserAccount;

    .line 94
    iput-object p2, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mNewAccount:Lcom/burstly/lib/currency/AccountInfo;

    .line 95
    return-void
.end method


# virtual methods
.method prepareRequest(Lcom/burstly/lib/currency/AccountInfo;)Lcom/burstly/lib/currency/request/LinkAccountRequest;
    .locals 3
    .parameter "newAccount"

    .prologue
    const/4 v2, 0x0

    .line 149
    new-instance v0, Lcom/burstly/lib/currency/request/LinkAccountRequest;

    invoke-direct {v0}, Lcom/burstly/lib/currency/request/LinkAccountRequest;-><init>()V

    .line 150
    .local v0, requestData:Lcom/burstly/lib/currency/request/LinkAccountRequest;
    iget-boolean v1, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mTryInactiveAccounts:Z

    if-eqz v1, :cond_0

    .line 151
    invoke-virtual {v0, v2}, Lcom/burstly/lib/currency/request/LinkAccountRequest;->setSearchActiveOnly(Z)V

    .line 152
    iput-boolean v2, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mTryInactiveAccounts:Z

    .line 154
    :cond_0
    iget-object v1, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mAccount:Lcom/burstly/lib/currency/UserAccount;

    invoke-virtual {v1}, Lcom/burstly/lib/currency/UserAccount;->getPubId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/burstly/lib/currency/request/LinkAccountRequest;->setPublisher(Ljava/lang/String;)V

    .line 155
    iget-object v1, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mAccount:Lcom/burstly/lib/currency/UserAccount;

    invoke-virtual {v1}, Lcom/burstly/lib/currency/UserAccount;->getUserId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/burstly/lib/currency/request/LinkAccountRequest;->setUserUid(Ljava/lang/String;)V

    .line 156
    invoke-virtual {p1}, Lcom/burstly/lib/currency/AccountInfo;->getPubId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/burstly/lib/currency/request/LinkAccountRequest;->setExternalPublisher(Ljava/lang/String;)V

    .line 157
    invoke-virtual {p1}, Lcom/burstly/lib/currency/AccountInfo;->getUserId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/burstly/lib/currency/request/LinkAccountRequest;->setExternalUserUid(Ljava/lang/String;)V

    .line 158
    return-object v0
.end method

.method public run()V
    .locals 4

    .prologue
    .line 99
    new-instance v0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable$1;

    const/4 v1, 0x0

    const-class v2, Lcom/burstly/lib/currency/request/AccountInfoResponse;

    invoke-direct {v0, p0, v1, v2}, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable$1;-><init>(Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;Ljava/lang/Object;Ljava/lang/Class;)V

    .line 111
    .local v0, currencyRequestTask:Lcom/burstly/lib/network/request/CurrencyRequestTask;,"Lcom/burstly/lib/network/request/CurrencyRequestTask<Lcom/burstly/lib/currency/request/AccountInfoResponse;>;"
    new-instance v1, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable$2;

    iget-object v2, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mAccount:Lcom/burstly/lib/currency/UserAccount;

    iget-object v3, p0, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;->mNewAccount:Lcom/burstly/lib/currency/AccountInfo;

    invoke-direct {v1, p0, v2, v3}, Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable$2;-><init>(Lcom/burstly/lib/currency/request/RequestLinkAccountRunnable;Lcom/burstly/lib/currency/UserAccount;Lcom/burstly/lib/currency/AccountInfo;)V

    invoke-virtual {v0, v1}, Lcom/burstly/lib/network/request/CurrencyRequestTask;->setCallback(Lcom/burstly/lib/network/request/IRequestCallback;)V

    .line 139
    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/burstly/lib/network/request/CurrencyRequestTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 140
    return-void
.end method
